import os
import sys


def get_base_path():
    """
    获取基础路径（兼容PyInstaller、Nuitka、开发环境）
    """
    if hasattr(sys, '_MEIPASS'):  # PyInstaller
        return os.path.dirname(sys.executable)
    elif '__compiled__' in globals():  # Nuitka
        return os.path.dirname(os.path.abspath(sys.argv[0]))
    else:  # 开发环境
        return os.path.dirname(os.path.abspath(__file__))


# 获得基础路径
base_path = get_base_path()
api_url = "http://127.0.0.1:5000/api"
app_id = 1001
proxies = {'http': None, 'https': None}
curr_version = 1.0

# 免责声明
privacy_policy = """<h3>免责声明</h3>
<p>本软件为完全免费的开源工具，旨在为教育工作者、学生及家长提供便捷的电子课本访问方式。所有功能均基于合法、公开的网络资源，开发者不存储、不托管任何教材内容。
<br>若您认为本软件侵犯到了您的合法权益，请联系微信：kdb267，将及时处理。
</p>

<h4>一、版权声明</h4>
<p>本软件仅用于学习和研究目的，不得用于任何商业用途。软件本身不存储、提供或售卖任何教材内容。教材版权归原出版社或相关版权所有方所有。开发者不对教材内容的合法性、完整性、准确性负责。请严格遵守相关法律法规：
<br> 1. 仅限个人学习、课堂教学或科研用途
<br> 2. 禁止用于商业用途或二次传播
<br> 3. 下载后请在24小时内删除
</p>

<h4>二、开源免费</h4>
<p>本软件为开源项目，所有源代码已在公开平台发布，任何人均可免费使用、修改、传播。作者不对任何由第三方修改后发布的版本承担责任。
</p>

<h4>三、合法合规使用</h4>
<p>用户在使用本软件时，须遵守所在国家/地区的法律法规。严禁将本软件用于任何非法目的。否则由此带来的问题均与软件作者无关。</p>

<h4>四、免责范围调整</h4>
<p>开发者保留随时修改本免责声明内容的权利。更新后的免责声明将即时生效，并适用于所有新版本软件的使用。</p>

<p>点击"同意"表示您已阅读并接受上述条款。如不同意，请立即卸载软件。</p>
"""

user_config_dir = os.path.join(os.path.expanduser("~"), ".wangnapao\\TextbookDownLoader")
if not os.path.exists(user_config_dir):
    os.makedirs(user_config_dir, exist_ok=True)
user_config_file = os.path.join(user_config_dir, "disclaimer.json")

image_data = {
    "fav.ico":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